<template>
	<view @click="goDetails" class="task-item-container">
		<view :class="[classData.className]"  class="tag">{{classData.tagName}}</view>
		<view class="title flex flex-items-center">
			<view>{{props.item.productListName}}</view>
			<view v-if="props.item.saleByWeight" class="type">称</view> 
		</view>
		<view class="merchant">
			<view>{{props.item.providerName}}</view>
			<view>{{props.item.id}}</view>
			<view class="footer flex flex-items-center">
				<view class="flex-1">{{ tools.timestampToTime(props.item.createTime,'yyyy-MM-dd hh:mm:ss')}}</view>
				<view class="number">{{item.quantityProcessed}}/{{props.item.quantity}} </view>
			</view>
		</view>
	</view>
</template>

<script setup> 
import tools from '../../../utils/tools'; 
const {proxy} = getCurrentInstance(); 
	const props  = defineProps({
		item: {
			type: Object,
			default: () => null
		},
		tabsList: {
			type: Array,
			default: () => {
				return []
			}
		}
	}); 
	let classData = computed(()=>{
		let arr = props.tabsList.filter(i=>i.value!=='');  
		return {
			className: (arr.find(i=>i.value==Number(props.item.taskStatus))||{})?.className,
			tagName:(arr.find(i=>i.value==Number(props.item.taskStatus))||{})?.name
		}
	}) 
	onMounted(()=>{  
		 
	}); 
	
	function goDetails($parent){ 
		uni.navigateTo({
			url:`/pages/task/pages/details/index?item=${encodeURIComponent(JSON.stringify(props.item))}`
		})
	}
</script>

<style lang="scss">
	@import 'index.scss';
</style>